﻿using System.Text;

namespace Chat.Common
{
    public enum CommandType
    {
        Control, Chat
    }
    public enum ControlType
    {
        GetRoomList, GetRoomInfo, EnterRoom, ExitRoom,
        EnterServer, ExitServer,
        GetOwner, SetOwner, GetMemList
    }
    public enum ChatType
    {
        Public, Private
    }
    class Common
    {
        public static readonly int idSize = 32;
        public static readonly int chtTypeSize = 10;
        public static readonly int cmdHeadSize = 4; //4 byte
        public static readonly int cmdTailSize = 4; //4 byte
        public static readonly int cmdTypeSize = 10; //10 byte
        public static readonly int ctlTypeSize = 20; // 
        public static readonly int maxBufferSize = 1024 * 100; // 100KB
        public static readonly string rcvDataHead = "Head";
        public static readonly string rcvDataTail = "Tail";

        /// <summary>
        /// 得到一个重复的字符串
        /// </summary>
        /// <param name="str">字符串</param>
        /// <param name="cnt">重复次数</param>
        /// <returns></returns>
        public static string GetLoopStr(string str, int cnt)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < cnt; i++)
                sb.Append(str);
            return sb.ToString();
        }
    }
}
